<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./sip-0.13.8.js"></script>
    <script src="./jquery.min.js"></script>
</head>
<body>
<video id="remoteVideo"></video>
<video id="localVideo" muted="muted"></video>
<div>状态：<span id="status">注册中...</span></div>
<div>
    <input type="text" id="phone">
    <button type="button" onclick="call()">拨打</button>
    <button type="button" onclick="hangup()">挂断</button>
    <button type="button" id="accept">接听</button>
</div>
<script>
    var options = {
        media: {
            local: {
                video: document.getElementById('localVideo')
            },
            remote: {
                video: document.getElementById('remoteVideo'),
                // This is necessary to do an audio/video call as opposed to just a video call
                audio: document.getElementById('remoteVideo')
            }
        },
        ua: {
            uri: '1001@ssl.nicaicai.top',
            transportOptions: {
                wsServers: ['wss://ssl.nicaicai.top:7443']
            },
            authorizationUser: '1001',
            password: '1234'
        }
    };
    var simple = new SIP.Web.Simple(options);

    simple.on('ringing', function() {
        alert("有来电");
        simple.answer();
    });

    function call() {
        var phone = $("#phone").val()+"@ssl.nicaicai.top";
        simple.call(phone);
    }

    function hangup() {
        simple.hangup();
    }


</script>

</body>
</html>